package EmployeeSalaryManagementSystem;

/**
 * 管理人员类 - 按月薪加奖金方式计薪
 */
public class Manager extends Employee {
    private double monthlySalary;
    private double bonus;

    public Manager(String name, String id, double monthlySalary) {
        super(name, id);
        this.monthlySalary = monthlySalary;
        this.bonus = 0;
    }

    @Override
    public double calculateSalary() {
        return monthlySalary + bonus;
    }

    @Override
    public String generatePaySlip() {
        double totalSalary = calculateSalary();
        StringBuilder paySlip = new StringBuilder();
        paySlip.append("=== 管理人员工资条 ===\n");
        paySlip.append("姓名: ").append(name).append("\n");
        paySlip.append("工号: ").append(id).append("\n");
        paySlip.append("月薪: ¥").append(String.format("%.2f", monthlySalary)).append("\n");
        paySlip.append("奖金: ¥").append(String.format("%.2f", bonus)).append("\n");
        paySlip.append("实发工资: ¥").append(String.format("%.2f", totalSalary)).append("\n");
        paySlip.append("=====================");
        return paySlip.toString();
    }

    // Getters and Setters
    public double getMonthlySalary() {
        return monthlySalary;
    }

    public void setMonthlySalary(double monthlySalary) {
        this.monthlySalary = monthlySalary;
    }

    public double getBonus() {
        return bonus;
    }

    public void setBonus(double bonus) {
        this.bonus = bonus;
    }
}